#ifndef _NUC_H_
#define _NUC_H_
#ifdef __cplusplus
extern "C" {
#endif

#include <cmsis_os2.h>
#include "struct_typedef.h"
#include "device.h"
#include "uart_it.h"

// 帧头针尾
#define HEAD (0xFF)
#define TAIL (0xFE)

#define ODOM (0x04)
#define PICK (0x06)
#define VISION (0x09)
#define SEND (0X07)

// 写结构体存入视觉信息
typedef struct {
    uint8_t status_fromnuc;
    uint8_t ctrl_status; // 取其中每一个二进制位用作通信

    uint8_t id;
    uint8_t mode;

    struct {
        fp32 x;
        fp32 y;
        fp32 z;
    } vision;

} NUC_t;

int8_t NUC_Init(NUC_t *nuc);
int8_t NUC_StartReceiving(void);
int8_t NUC_Restart(void);
bool_t NUC_WaitDmaCplt(void);
int8_t NUC_RawParse(NUC_t *n);
int8_t NUC_HandleOffline(NUC_t *cmd);
int8_t NUC_SendPacket(void *data, uint16_t length);

#ifdef __cplusplus
}
#endif
#endif // _NUC_H_
